import {createRouter, createWebHashHistory} from 'vue-router';


import Login from "@/views/Login.vue";
import Index from "@/views/Index.vue";
import SysUser from "@/views/sys/SysUser.vue";


const router = createRouter({
  history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
  routes: [
    {
      path: '/',
      component: Login
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/sysMain',
      name: 'sysMain',
      component: Index,
      redirect: '/sysUser',
      children: [
        {
          path: '/sysUser',
          name: 'sysUser',
          component: SysUser
        },
        {
          path: '/sysRole',
          name: 'sysRole',
          component: () => import(/* webpackChunkName: "hot" */ '../views/sys/SysRole.vue')
        },
        {
          path: '/sysPermission',
          name: 'sysPermission',
          component: () => import(/* webpackChunkName: "hot" */ '../views/sys/SysPermission.vue')
        },
        {
          path: '/drugCategoryManagement',
          name: 'drugCategoryManagement',
          component: () => import(/* webpackChunkName: "hot" */ '../views/sys/DrugCategoryManagement.vue')
        },
        // 供应商管理
        {
          path: '/supplierManagement',
          name: 'supplierManagement',
          component: () => import(/* webpackChunkName: "hot" */ '../views/sys/SupplierManagement.vue')
        },
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import(/* webpackChunkName: "dashboard" */ '../views/Index.vue')
        },

        // 药店管理
        {
          path: '/pharmacyManagement',
          name: 'pharmacyManagement',
          component: () => import(/* webpackChunkName: "hot" */ '../views/shop/ShopManagement.vue')
        },
        {
          path: '/drugManagement',
          name: 'drugManagement',
          component: () => import(/* webpackChunkName: "hot" */ '../views/shop/MedicineManagement.vue')
        },
        // 订单管理
        {
          path: '/orderManagement',
          name: 'orderManagement',
          component: () => import(/* webpackChunkName: "hot" */ '../views/shop/Orders.vue')
        }


      ]
    },
    {
      path: '/userFront',
      name: 'userFront',
      component: () => import(/* webpackChunkName: "userFront" */ '../views/user/UserFront.vue'),
      redirect: '/shopIndex',
      children: [
        {
          path: '/',
          name: '主页',
          component: () => import(/* webpackChunkName: "userFront" */ '../views/user/ShopIndex.vue')
        },
        {
          path: '/shopIndex',
          name: 'shopIndex',
          component: () => import(/* webpackChunkName: "userFront" */ '../views/user/ShopIndex.vue')
        },
        {
          path: '/shoppingCart',
          name: 'shoppingCart',
          component: () => import(/* webpackChunkName: "userFront" */ '../views/user/shoppingCart.vue')
        },
        {
          path: '/userInfo',
          name: 'userInfo',
          component: () => import('../views/user/UserInfo.vue')
        },
        {
          path: '/productDetail',
          name: 'productDetail',
          component: () => import('@/views/user/ProductDetail.vue')
        }

      ]
    },

  ]
});

export default router;
